<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>不挂高数管理页-用户</title>
    <!-- Favicon -->
    <link rel="shortcut icon" href="/favicon.png"/>
    <link rel="bookmark" href="/favicon.png"/>
    <!-- Icons -->
    <link href="/assets/vendor/nucleo/css/nucleo.css" rel="stylesheet">
    <link href="/assets/vendor/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
    <!-- Argon CSS -->
    <link type="text/css" href="/assets/css/argon.css?v=1.0.0" rel="stylesheet">
    <style type="text/css">

    </style>
    <script src="/js/jquery-3.4.1.min.js"></script>
</head>

<body>
<!-- Sidenav -->

<nav class="navbar navbar-vertical fixed-left navbar-expand-md navbar-light bg-white" id="sidenav-main">
    <div class="container-fluid">
        <!-- Toggler -->
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#sidenav-collapse-main" aria-controls="sidenav-main" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <!-- Brand -->
        <a class="navbar-brand pt-0" href="/admin/main">
            <img src="/favicon.png" class="navbar-brand-img" alt="不挂高数社区">
            不挂高数社区
        </a>
        <!-- User -->
        <ul class="nav align-items-center d-md-none">
            <li class="nav-item dropdown">
                <a class="nav-link" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <div class="media align-items-center">
              <span class="avatar avatar-sm rounded-circle">
                <img alt="用户头像" th:src="${session.admin.getHeadUrl()}">
              </span>
                    </div>
                </a>
                <div class="dropdown-menu dropdown-menu-arrow dropdown-menu-right">
                    <div class=" dropdown-header noti-title">
                        <h6 id="welcome-text-1" class="text-overflow m-0">Welcome!</h6>
                    </div>

                    <div class="dropdown-divider"></div>
                    <a href="/admin/signOut" class="dropdown-item">
                        <i class="ni ni-user-run"></i>
                        <span>退出</span>
                    </a>
                </div>
            </li>
        </ul>
        <!-- Collapse -->
        <div class="collapse navbar-collapse" id="sidenav-collapse-main">
            <!-- Collapse header -->
            <div class="navbar-collapse-header d-md-none">
                <div class="row">
                    <div class="col-6 collapse-brand">
                        <a href="/admin/main">
                            <img src="/favicon.png">
                        </a>
                        不挂高数社区
                    </div>
                    <div class="col-6 collapse-close">
                        <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#sidenav-collapse-main" aria-controls="sidenav-main" aria-expanded="false" aria-label="Toggle sidenav">
                            <span></span>
                            <span></span>
                        </button>
                    </div>
                </div>
            </div>
            <!-- Form -->
            <form class="mt-4 mb-3 d-md-none" action="/admin/search" method="get">
                <div class="input-group input-group-rounded input-group-merge">
                    <input name="search" type="search" class="form-control form-control-rounded form-control-prepended" placeholder="搜索用户或问题" aria-label="Search">
                    <div class="input-group-prepend">
                        <div class="input-group-text">
                            <span class="fa fa-search"></span>
                        </div>
                    </div>
                </div>
            </form>
            <!-- Navigation -->
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" href="/admin/main">
                        <i class="ni ni-tv-2 text-primary"></i> 主页
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/question">
                        <i class="ni ni-bullet-list-67 text-red"></i> 问题信息
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="/admin/user">
                        <i class="ni ni-single-02 text-yellow"></i> 用户信息
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/search">
                        <i class="ni ni-planet text-blue"></i> 搜索
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/controller">
                        <i class="ni ni-key-25 text-info"></i> 社区设置
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/admin/advertisement">
                        <i class="ni ni-bullet-list-67 text-red"></i> 广告和新闻设置
                    </a>
                </li>
            </ul>
            <!-- Divider -->
            <hr class="my-3">
            <!-- Heading -->



        </div>
    </div>
</nav>
<!-- Main content -->
<div class="main-content">
    <!-- Top navbar -->
    <nav class="navbar navbar-top navbar-expand-md navbar-dark" id="navbar-main">
        <div class="container-fluid">
            <!-- Brand -->
            <a class="h4 mb-0 text-white text-uppercase d-none d-lg-inline-block" href="#">用户列表</a>
            <!-- Form -->
            <form class="navbar-search navbar-search-dark form-inline mr-3 d-none d-md-flex ml-lg-auto" action="/admin/search" method="get">
                <div class="form-group mb-0">
                    <div class="input-group input-group-alternative">
                        <div class="input-group-prepend">
                            <span class="input-group-text"><i class="fas fa-search"></i></span>
                        </div>
                        <input name="search" class="form-control" placeholder="搜索用户或问题" type="text">
                    </div>
                </div>
            </form>
            <!-- User -->
            <ul class="navbar-nav align-items-center d-none d-md-flex">
                <li class="nav-item dropdown">
                    <a class="nav-link pr-0" href="#" role="button" data-toggle="dropdown" aria-haspopup="true"
                       aria-expanded="false">
                        <div class="media align-items-center">
                <span class="avatar avatar-sm rounded-circle">
                  <img alt="管理员头像" th:src="${session.admin.getHeadUrl()}">
                </span>
                            <div class="media-body ml-2 d-none d-lg-block">
                                <span class="mb-0 text-sm  font-weight-bold" id="right_top_name" th:text="${session.admin.getUserName()}"></span>
                            </div>
                        </div>
                    </a>
                    <div class="dropdown-menu dropdown-menu-arrow dropdown-menu-right">
                        <div class=" dropdown-header noti-title">
                            <h6 id="welcome-text-2" class="text-overflow m-0">Welcome!</h6>
                        </div>


                        <div class="dropdown-divider" id="logout"></div>
                        <a href="/admin/signOut" class="dropdown-item">
                            <i class="ni ni-user-run"></i>
                            <span>退出</span>
                        </a>
                    </div>
                </li>
            </ul>
        </div>
    </nav>
    <!-- Header -->
    <div class="header bg-gradient-primary pb-8 pt-5 pt-md-8">
        <div class="container-fluid">
            <div class="header-body">
                <!-- Card stats -->

            </div>
        </div>
    </div>
    <!-- Page content -->
    <div class="container-fluid mt--7" >
        <!-- Table -->
        <div class="row">
            <div class="col">
                <div class="card shadow">
                    <div class="card-header border-0">
                        <h3 class="mb-0">所有用户</h3>
                    </div>
                    <div class="table-responsive" id="classTable">
                        <table class="table align-items-center table-flush">
                            <thead class="thead-light">
                            <tr>
                                <th scope="col">用户头像</th>
                                <th scope="col">用户ID</th>
                                <th scope="col">用户账号</th>
                                <th scope="col">用户邮箱</th>
                                <th scope="col">用户昵称</th>
                                <th scope="col">加入时间</th>
                                <th scope="col">用户权限</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="user:${paginationDto.data}">
                                <th scope="row">
                                    <div class="media align-items-center">
                                        <a th:href="${'/user/' + user.getUserId()}" class="avatar rounded-circle mr-3">
                                            <img alt="用户头像" th:src="${user.getHeadUrl()}">
                                        </a>
                                    </div>
                                </th>
                                <td >
                                    <a th:href="${'/user/' + user.getUserId()}">
                                        <span th:text="${user.getId()}"></span>
                                    </a>
                                </td>
                                <td>
                                    <a th:href="${'/user/' + user.getUserId()}">
                                        <span class="badge badge-dot mr-4" th:text="${user.getUserId()}"></span>
                                    </a>
                                </td>
                                <td th:text="${user.getEmail()}">

                                </td>
                                <td th:text="${user.getUserName()}">

                                </td>
                                <td th:text="${user.getCreationTime()}">

                                </td>
                                <td class="text-right" >
                                    <span th:if="${user.getPower() == 1}">普通用户</span>
                                    <span th:if="${user.getPower() == 0}" style="font-weight: bold; font-size: 20px">管理员</span>
                                    <span th:if="${user.getPower() == 2}" style="color: #ffe375; font-weight: bold; font-size: 20px">VIP用户</span>
                                    <div class="dropdown">
                                        <a class="btn btn-sm btn-icon-only text-light" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            <i class="fas fa-ellipsis-v"></i>
                                        </a>
                                        <div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow" x-placement="top-end" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(32px, -2px, 0px);">
                                            <button th:data-id="${user.getId()}" class="dropdown-item" onclick="sendUserPower(this, 0)">设置为管理员</button>
                                            <button th:data-id="${user.getId()}" class="dropdown-item" onclick="sendUserPower(this, 2)">设置为VIP</button>
                                            <button th:data-id="${user.getId()}" class="dropdown-item" onclick="sendUserPower(this, 1)">恢复普通用户</button>
                                            <button th:data-id="${user.getId()}" class="dropdown-item" onclick="resetPassword(this)">重置密码</button>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="card-footer py-4">
                        <nav aria-label="Page navigation example" th:if="${paginationDto.totalPage} != 0">
                            <ul class="pagination justify-content-end">
                                <!-- 返回首页 -->
                                <li class="page-item" th:if="${paginationDto.showFirstPage}">
                                    <a class="page-link" id="first-page-a" href="/admin/user"
                                       aria-label="Previous" onclick="addLocaleUrlForPage('first-page-a')">
                                        <span aria-hidden="true">&laquo;&laquo;</span>
                                        <span class="sr-only">Previous</span>
                                    </a>
                                </li>
                                <!-- 上一页 -->
                                <li class="page-item" th:if="${paginationDto.showPrevious}">
                                    <a class="page-link" id="link-to-last-a"
                                       th:href="'/admin/user' + @{/(page=${paginationDto.nowPage} - 1)}"
                                       aria-label="Previous"
                                       onclick="addLocaleUrlForPage('link-to-last-a')">
                                        <span aria-hidden="true">&laquo;</span>
                                        <span class="sr-only">Previous</span>
                                    </a>
                                </li>


                                <li class="page-item" th:each="page : ${paginationDto.pages}"
                                    th:class="${paginationDto.nowPage == page}? 'page-item active' : 'page-item'">
                                    <a class="page-link" th:href="${'/admin/user?page='+page}"
                                       th:text="${page}" th:id="${page}"
                                       th:onclick="'javascript:addLocaleUrlForPage(\''+${page}+'\')'">
                                        1
                                    </a>
                                </li>


                                <!-- 下一页 -->
                                <li class="page-item" th:if="${paginationDto.showNext}">
                                    <a class="page-link" id="lind-to-next-a"
                                       th:href="'/admin/user/' + @{/(page=${paginationDto.nowPage} + 1)}"
                                       aria-label="Next"
                                       onclick="addLocaleUrlForPage('lind-to-next-a')">
                                        <span aria-hidden="true">&raquo;</span>
                                        <span class="sr-only">Next</span>
                                    </a>
                                </li>
                                <!-- 最后一页 -->
                                <li class="page-item" th:if="${paginationDto.showEndPage}">
                                    <a class="page-link" id="link-to-end-a"
                                       th:href="'/admin/user/' + @{/(page=${paginationDto.totalPage})}"
                                       th:if="${paginationDto.showEndPage}"
                                       aria-label="Next" onclick="addLocaleUrlForPage('link-to-end-a')">
                                        <span aria-hidden="true">&raquo;&raquo;</span>
                                        <span class="sr-only">Next</span>
                                    </a>
                                </li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>



        <!-- Footer  -->
        <footer class="footer">
            <div class="row align-items-center justify-content-xl-between">
                <div class="col-xl-6">
                    <div class="copyright text-center text-xl-left text-muted">
                        &copy; 2019 <a href="/" class="font-weight-bold ml-1"
                                      >不挂高数社区</a>
                    </div>
                </div>
                <div class="col-xl-6">
                    <ul class="nav nav-footer justify-content-center justify-content-xl-end">
                        <li class="nav-item">
                            <a href="#" class="nav-link" target="_blank"></a>
                        </li>
                        <li class="nav-item">
                            <a href="#" class="nav-link"></a>
                        </li>

                        <li class="nav-item">
                            <a href="#"
                               class="nav-link" target="_blank"></a>
                        </li>
                    </ul>
                </div>
            </div>
        </footer>

    </div>
</div>
<!-- Argon Scripts -->
<!-- Core -->

<script src="/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- Argon JS -->
<script src="/assets/js/argon.js?v=1.0.0"></script>
<script src="/js/admin.js"></script>

</body>

</html>